package com.abbas.smartCity.ui.youthInn;

import android.webkit.WebView;
import android.widget.TextView;

import com.abbas.smartCity.R;
import com.abbas.smartCity.base.BaseActivity;
import com.abbas.smartCity.bean.inn.TalentPolicyDetailBean;
import com.abbas.smartCity.retroft.ICallback;

import retrofit2.Call;

public class TalentPolicyDetailActivity extends BaseActivity {

    private TextView title;
    private TextView time;
    private TextView publisher;
    private WebView web;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_talent_policy_detail;
    }

    @Override
    protected String setCustomTitle() {
        return "政策详情";
    }

    @Override
    protected void initView() {
        title = (TextView) findViewById(R.id.title);
        time = (TextView) findViewById(R.id.time);
        publisher = (TextView) findViewById(R.id.publisher);
        web = (WebView) findViewById(R.id.web);
    }

    @Override
    protected void initData() {
        final int id = getIntent().getIntExtra("id", -1);

        api.getTalentPolicyDetail(id).enqueue(new ICallback<TalentPolicyDetailBean>() {
            @Override
            public void onSuccess(Call<TalentPolicyDetailBean> call, TalentPolicyDetailBean data) {
                final TalentPolicyDetailBean.DataBean dataBean = data.getData();
                title.setText(dataBean.getTitle());
                time.setText(dataBean.getCreateTime());
                publisher.setText(dataBean.getAuthor());
                web.loadDataWithBaseURL(null,dataBean.getContent(),null,null,null);
            }
        });
    }

    @Override
    protected void initEvent() {

    }
}